package com.ztao.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.heima.model.common.admin.dto.SensitiveDto;
import com.heima.model.common.admin.pojos.WmSensitive;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.ztao.mapper.SensitiveMapper;
import com.ztao.service.SensitiveService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class SensitiveServiceImpl implements SensitiveService {
    @Resource
    private SensitiveMapper sensitiveMapper;
    @Override
    public ResponseResult findAll_Sensitive(SensitiveDto dto) {
        IPage<WmSensitive> page=new Page<>(dto.getPage(),dto.getSize());
        QueryWrapper<WmSensitive> wrapper=new QueryWrapper<>();
        wrapper.lambda().like(WmSensitive::getSensitives,dto.getName());
        page=this.sensitiveMapper.selectPage(page,wrapper);
        ResponseResult result=new PageResponseResult(dto.getPage(),dto.getSize(),(int)page.getTotal());
        result.setData(page.getRecords());
        return result;
    }
}
